<?php 
$db = include('../Application/Common/Conf/config.php');  
$host =  $db['DB_HOST'];
$port =  $db['DB_PORT'];
$dbname =  $db['DB_NAME'];
$user =  $db['DB_USER'];
$psw =  $db['DB_PWD'];
$dbconn = pg_connect("host=$host port=$port dbname=$dbname user=$user password=$psw");
		 if($dbconn)
		 {
			if(!empty($_POST)){
				$nid = $_POST['inid'];
				$sql = "select count(*) from tbuseraccount where nuserid=$nid;";
				$R = pg_query($dbconn,$sql);
				$total = pg_fetch_all($R);

				if($total[0]['count']==0){
					echo 1;					
				}else{					
					$sql = "select calias from tbuserinformation where nuserid=$nid;";
					$R  = pg_query($dbconn,$sql);
					$total = pg_fetch_all($R);
					echo $total[0]['calias'];
				}
			 }
			

		}
?>